<%
  #File:    /app/views/manage/documents/_form.rhtml
  #Author:  Andrew Stone
  #Created: 08.25.2006
  title = "Creating document category" 
  title = "Updating #{@category.name}" if @category.id
  action = "create"
  action = "update" if @category.id
%>

<%=error_messages_for("category")%>

<%=start_form_tag(:action => action)%>

<%=start_large_div_wrapper%>
  <div id="page_title"><%=title%></div>
  <div id="large">
    <table>
      <tbody>
        <tr>
          <td class="req_label">* Name:</td>
          <td class="data"><%=text_field("category","name")%></td>
        </tr>
        <tr>
          <td class="req_label">* Title:</td>
          <td class="data"><%=text_field("category","title")%></td>
        </tr>
        <tr>
          <td class="list_label">Description:</td>
          <td class="list_data"> <%=text_area("category","description",{"cols" => 60, "rows" => 6})%> </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>
            <strong>Select which pages will contain these documents</strong><br/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Listed as <strong>Folder</strong>: <i>page</i></td>
        </tr>
        <tr>
          <td class="list_label">Pages:</td>
          <td class="list_data">
            <ul id="document_pages" class="checklist">
            <%
              i = 0
              pgs = Page.list_by_folder
              pgs.each do |pg|
                bg = row_class(i)
                i += 1 %>
                <%=checklist_li(pg[:name] ,"page",pg[:id],bg,@category.has_page?(pg[:id]))%>
            <%
              end
            %>
            </ul>
          </td>
        </tr>
      </tbody>
    </table>
    <%=hidden_field("category","id")%>
    <div id="actions">
      <%=submit_tag("Cancel")%>
      <%=submit_tag(action.capitalize)%>
    </div>
  </div>
<%=end_div_wrapper%>
<%=end_form_tag%>

